package com.block.datapush.spread.service.impl;

import com.block.datapush.spread.factory.SpreadFactory;
import com.block.datapush.spread.service.ISpreadHandlerService;
import com.block.db.entity.MemberExtInfo;
import com.block.db.entity.SpreadBaseInfo;
import com.block.db.mapper.SpreadBaseInfoMapper;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

@Service
public class SpreadHandlerServiceImpl implements ISpreadHandlerService {

    @Resource
    SpreadBaseInfoMapper spreadBaseInfoMapper;

    @Override
    public void execSpreadInfo(MemberExtInfo memberExtInfo){
        List<SpreadBaseInfo> baseInfoList = spreadBaseInfoMapper.getEnableListEntity();
        for (SpreadBaseInfo spreadBaseInfo: baseInfoList){

            SpreadFactory.getService(spreadBaseInfo.getFactoryType()).spreadExecHandler(memberExtInfo, spreadBaseInfo);

        }

    }

}
